package com.touchealth.test.bean;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhangyanqiang
 * @date 2019/11/29
 **/
public class BeanCopy {

    public static void main(String[] args) {

        List<Student> students = new ArrayList<>();
        List<Teacher> teacherList = new ArrayList<>();

        Student student_tmp = new Student();
        Teacher teacher_tmp = new Teacher();
        student_tmp.setName("小明");
        teacher_tmp.setName("李老师");
        teacher_tmp.setAge(25);
        for (int i=0;i<3;i++){
            Student studenti = new Student();
            studenti.setAddress("北京"+i);
            studenti.setAge(i+10);
            studenti.setName("小明"+i);
            List<Book> books = new ArrayList<>();
            for (int j=0;j<3;j++){
                Book book = new Book();
                book.setHeight(i+j+20);
                book.setName("深度学习"+i+j);
                books.add(book);
            }
            studenti.setBookList(books);
            students.add(studenti);

        }

//        students.stream().forEach(s ->{
//            s.getBookList().stream().forEach(book -> {
//                book.setName("张延强");
//            });
//        });

        System.out.print(students.stream().filter(s -> s.getAge().intValue() == -1).mapToInt(Student::getAge).sum());

        System.out.print(students.get(0).hashCode());

//        teacherList = Convert.toList(Teacher.class,students);
//
//        for (Teacher teacher : teacherList) {
//
//            System.out.println(teacher.getBookList().get(0).getName()+"=========");
//        }
    }
}
